package com.example.gl_project5;

import android.opengl.GLES20;

public class Light {
	private int position;
	private int color;
	private int attenuation0;
	private int attenuation1;
	private int attenuation2;
	
	public void send(float[] position, float[] color, float attenuation0, float attenuation1, float attenuation2) {
		GLES20.glUniform3f(this.position, position[0], position[1], position[2]);
		GLES20.glUniform4f(this.color, color[0], color[1], color[2], color[3]);
		GLES20.glUniform1f(this.attenuation0, attenuation0);
		GLES20.glUniform1f(this.attenuation1, attenuation1);
		GLES20.glUniform1f(this.attenuation2, attenuation2);
	}
	
	public void load(int programHandle) {
		setPosition(GLES20.glGetUniformLocation(programHandle, "light1.position"));
	    setColor(GLES20.glGetUniformLocation(programHandle, "light1.color"));
	    setAttenuation0(GLES20.glGetUniformLocation(programHandle, "light1.attenuation0"));
	    setAttenuation1(GLES20.glGetUniformLocation(programHandle, "light1.attenuation1"));
	    setAttenuation2(GLES20.glGetUniformLocation(programHandle, "light1.attenuation2"));
	}
	
	public int getPosition() {
		return position;
	}
	public void setPosition(int position) {
		this.position = position;
	}
	public int getColor() {
		return color;
	}
	public void setColor(int color) {
		this.color = color;
	}
	public int getAttenuation0() {
		return attenuation0;
	}
	public void setAttenuation0(int attenuation0) {
		this.attenuation0 = attenuation0;
	}
	public int getAttenuation1() {
		return attenuation1;
	}
	public void setAttenuation1(int attenuation1) {
		this.attenuation1 = attenuation1;
	}
	public int getAttenuation2() {
		return attenuation2;
	}
	public void setAttenuation2(int attenuation2) {
		this.attenuation2 = attenuation2;
	}
}
